package klasy.powtorka;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
//import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class StringApi {

	public static void main(String[] args) {

		System.out.println("Ala".indexOf("Ala ma kota"));
		System.out.println(("      la   la  Ala Kota Ma la "
				+ "    oh la la    ").trim().toLowerCase().toUpperCase());

		String s = "Kasia";
		System.out.println(s);
		s = s + " i Tomek";
		System.out.println(s);
		StringBuilder sb = new StringBuilder("Kasia").append(" i Tomek");
		System.out.println(sb);

		StringBuilder lancuch = new StringBuilder();
		for (int i = 0; i < 10; i++)
			lancuch.append(Integer.toString(i));
		System.out.println(lancuch);
		lancuch.setCharAt(3, 'c');
		System.out.println(lancuch);
		lancuch.insert(5, 'k');
		lancuch.insert(6, 'o');
		lancuch.insert(7, 't');
		System.out.println(lancuch);
		lancuch.delete(0, 5);
		System.out.println(lancuch);

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
				System.out));
		try {
			bw.write("Ala ma kota");
//			bw.close();
		} catch (IOException e1) {
			e1.printStackTrace();
		}

		String sin;
		System.out.println("Pisz:");
		try {
			while ((sin = br.readLine()) != null)
				System.out.println(sin);
			br.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
